//
//  BaseNet.m
//  SportSocial
//
//  Created by yull on 14/12/4.
//  Copyright (c) 2014年 yull. All rights reserved.
//

#import "BaseNet.h"

@implementation BaseNet

+ (NSString *)baseUrl
{
    return @"http://www.tengzhenkeji.com:9081/api";
}

+ (NSString *)token
{
    NSString *tempToken = [CurrentUser shareInstance].token;
    if (!tempToken) {
        tempToken = @"";
    }
    return tempToken;
}

+ (AFHTTPRequestOperationManager *)manager
{
    AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager];
    [manager.requestSerializer setValue:@"application/x-www-form-urlencoded" forHTTPHeaderField:@"Content-Type"];
    manager.responseSerializer.acceptableContentTypes = [NSSet setWithObjects:@"application/json", @"text/json", @"text/javascript",@"text/html",@"text/plain", nil];

    return manager;
}

+ (NSString *)handleResultCode:(NSInteger)resultCode
{
    if (resultCode == 100) {
        return nil;
    }else if (resultCode == 101)
    {
        return @"未登录";
    }else if (resultCode == 102) {
        return @"权限不足";
    }else if (resultCode == 500) {
        return @"服务器内部错误!";
    }else {
        return @"一般错误";
    }
}
@end
